package com.example.distillapplication.data.dao;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;

import com.example.distillapplication.data.entity.UserInfo;

import java.util.List;

@Dao
public interface UserInfoDao {
    @Insert
    void insertUserInfo(UserInfo... userInfos);

    @Query("SELECT * FROM UserInfo WHERE userAccount = :userAccount")
    List<UserInfo> findByAccount(String userAccount);

    @Query("SELECT * FROM UserInfo WHERE userId = :id")
    List<UserInfo> findByUserId(int id);

    @Query("SELECT * FROM UserInfo ORDER BY userId DESC")
    LiveData<List<UserInfo>> getAllUser();

    @Delete
    void deleteUserInfo(UserInfo... userInfos);
}
